from django.db import models

from core.mixin.managers import CustomManager
from core.mixin.models import TimeStampedModel, BaseQuerySet


class ToolkitManager(CustomManager):

    def get_queryset(self):
        return BaseQuerySet(self.model, using=self._db)


class Toolkit(TimeStampedModel):
    name = models.CharField('', max_length=50)
    url = models.CharField('', max_length=100)
    describe = models.CharField('', max_length=150)
    created_by = models.ForeignKey('authentication.User', on_delete=models.CASCADE)
    objects = ToolkitManager()

    class Meta:
        verbose_name = "工具箱"
        verbose_name_plural = verbose_name
        ordering = ['-created']
